﻿using System.Collections.Generic;

namespace XcoAppSpaces.Core.Ports.Remoting
{
	/// <summary>
	/// Interface that is implemented by port/portset to allow posting remoted messages (= messages that have been received from a remote appspace)
	/// including their context.
	/// </summary>
	public interface IRemotedPost
	{
		/// <summary>
		/// Posts a message with the given remote information, which will be available as context in the port's processor method.
		/// This is a more direct route for messages coming in from remote locations, since it prevents having to install causalities
		/// before posting, and then having the port collect them again.
		/// </summary>
		/// <param name="item">The item to be posted.</param>
		/// <param name="causalities">The list of active causalities.</param>
		/// <param name="msgContext">The message context, containing additional information about the message (e.g. source address).</param>
		void PostRemoted(object item, IEnumerable<ICausality> causalities, MessageContext msgContext);
	}
}